package tt.dz.order.vo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;
import tt.dz.order.util.OrderConstant.OrderStatus;

/**
 * 
 * 
 * @name 查询订单的状态
 * @author Anson
 * @version 1.0
 * @summary
 * @desc
 *
 */
public class QueryOrderStatusVo extends BaseVo {

	/** 订单号 */
	private String orderNo;

	/** 订单状态码说明 */
	private String status;

	/** 订单状态码 */
	private Integer statusCode;

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Integer getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(Integer statusCode) {
		this.statusCode = statusCode;
	}

	/**
	 * 查询订单状态
	 * 
	 * @author Anson
	 * @createDate 2016年5月1日
	 * @desc 根据传入的订单号集合，查询所有其对应的订单状态以及订单状态码
	 * @param orderNos
	 *            订单号集合
	 * @return 订单状态数据集合
	 *
	 */
	public static List<QueryOrderStatusVo> queryOrderStatus(List<String> orderNos) {
		String sql = "select orderNo, status as statusCode from order_info where orderNo in(:orderNos)";
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("orderNos", orderNos);
		List<QueryOrderStatusVo> vos = BaseDAOUtil.queryForList(sql.toString(), paramMap, QueryOrderStatusVo.class);
		if(vos != null && vos.size() > 0){
			for(QueryOrderStatusVo vo : vos){
				vo.setStatus(OrderStatus.getDesc(vo.getStatusCode()));
			}
		}
		return vos;
	}
}
